<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charSet="utf-8"/>
    <meta http-equiv="x-ua-compatible" content="ie=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
    <title>TinyMCE</title>
</head>

<body>
<h1>TinyMCE快速开始示例</h1>
<form method="post">
    <textarea id="mytextarea">Hello, World!</textarea>
</form>
<p>
    <a href="https://www.tiny.cloud/get-tiny/self-hosted/" target="_blank">TinyMCE下载</a> |
    <a href="https://www.tiny.cloud/get-tiny/language-packages/" target="_blank">TinyMCE语言包下载</a> |
    <a href="https://www.tiny.cloud/docs/" target="_blank">TinyMCE官方文档</a> |
    <a href="http://tinymce.ax-z.cn/" target="_blank">TinyMCE中文文档</a>
</p>
<script src="./tinymce/tinymce.min.js"></script>
<script>
    tinymce.init({
        selector: '#mytextarea',
        height: 600,
        language: 'zh_CN',
        plugins: ['image', 'batchUploadImage', 'code', 'help'],
        toolbar: 'undo redo | formatselect | bold italic forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table link removeformat | image batchUploadImage code help',
        images_upload_handler: function (blobInfo, success, fail) {
            // 图片上传实现 http://tinymce.ax-z.cn/general/upload-images.php
            // upload(blobInfo.blob());

            // 模拟上传
            setTimeout(function () {
                if (Math.random() * 10 > 2) {
                    success('https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png');
                } else {
                    fail();
                }
            }, 1000);
        },
    });
</script>
</body>
</html>